//
//  UIColor+CJColor.m
//  CJUIFactory
//
//  Created by mac on 2019/4/22.
//  Copyright © 2019年 zcj. All rights reserved.
//

#import "UIColor+CJColor.h"

@implementation UIColor (CJColor)

+ (UIColor *)cjRandomColor
{
    return CJRandomColor;
}

+ (UIColor *)cjClearColor{
  
    return [UIColor clearColor];
}

+ (UIColor *)cjBackgroundColor{
    
    return CJRGB16Color(0xF2F2F2);
}

+ (UIColor *)cjLineBackGroundColor{
    
    return CJRGB16Color(0xE5E5E5); //CJRGBColor(229, 229, 229);
}
+ (UIColor *)cjMainColor{
    return CJRGB16Color(0x2D7DF6);

}


/// 主题色 字体
+ (UIColor *)cjMainColorText{
    return CJRGB16Color(0x2D7DF6);

}

/**
 主 字体颜色
 
 @return <#return value description#>
 */
+ (UIColor *)cjMainTextColor{
    
    return CJRGB16Color(0x434C67);
}

/**
 次级 颜色字体
 
 @return <#return value description#>
 */
+ (UIColor *)cjSubheadTextColor{
    
    return CJRGB16Color(0x96A0B9);

}

+ (UIColor *)cjStarRateColor{
    
    return CJRGB16Color(0xFF7E15 );

}
+ (UIColor *)cjEmptyStarRateColor{
    
    return CJRGB16Color(0xB5CAEA);

}


/// 分割线颜色
+ (UIColor *)cjLineColor{
    
    return CJRGB16Color(0xE4E9ED);

}
// 基础色 

+ (UIColor *)cjWhiteColor{
    
    return [UIColor whiteColor];
}
+ (UIColor *)cjBlackColor{
    
    return [UIColor blackColor];
}

+ (UIColor *)cjGrayColor{
    
    return [UIColor grayColor];
}

+ (UIColor *)cjLightGrayColor{
    
    return [UIColor lightGrayColor];
}

+ (UIColor *)cjBlueColor{
    
    return [UIColor blueColor];
}

+ (UIColor *)cjRedColor;{
    
    return [UIColor redColor];
}

+ (UIColor *)cjColorWithHexString:(NSString *)hexString alpha:(CGFloat)alpha {
    NSString *cString = [[hexString stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] uppercaseString];
    
    // String should be 6 or 8 characters
    if ([cString length] < 6) {
        return [UIColor clearColor];
    }
    // 判断前缀
    if ([cString hasPrefix:@"0X"])
        cString = [cString substringFromIndex:2];
    if ([cString hasPrefix:@"#"])
        cString = [cString substringFromIndex:1];
    if ([cString length] != 6)
        return [UIColor clearColor];
    // 从六位数值中找到RGB对应的位数并转换
    NSRange range;
    range.location = 0;
    range.length = 2;
    //R、G、B
    NSString *rString = [cString substringWithRange:range];
    range.location = 2;
    NSString *gString = [cString substringWithRange:range];
    range.location = 4;
    NSString *bString = [cString substringWithRange:range];
    // Scan values
    unsigned int r, g, b;
    [[NSScanner scannerWithString:rString] scanHexInt:&r];
    [[NSScanner scannerWithString:gString] scanHexInt:&g];
    [[NSScanner scannerWithString:bString] scanHexInt:&b];
    
    return [UIColor colorWithRed:((float) r / 255.0f) green:((float) g / 255.0f) blue:((float) b / 255.0f) alpha:alpha/100.f];
}

@end
